<template>
	<view>
		<button class="btn-red" type="primary" @click="makeCall" style="width: 90%;">联系业务员</button>
		<uni-section class="pub-title" title="出单记录" type="line"></uni-section>
		<uni-list v-for="(item ,index) in chudjlList" :key="index">
			<uni-list-item :title="item.chanpMc" :note="item.baodxq" :thumb="item.avatar" thumb-size="lg"
				rightText="详情" clickable @click="onClick(item)"></uni-list-item>
		</uni-list>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				chudjlList: []
			}
		},
		onLoad() {
			let that = this
			
			uni.request({
				url: getApp().globalData.serviceUrl + "/myteam/kuybTeam/getPolicyListByOpenId",
				data: {
					openId: uni.getStorageSync("memberDetail").openid,
				},
				header: {
					"X-Access-Token": uni.getStorageSync("token")
				},
				dataType: 'json',
				method: 'GET',
				success: (result) => {
					if (result.data.success) {
						result.data.result.forEach(element => {
							element.baodxq = "出单时间: " + element.createTime + " \n会员: " + element.beibxr + " 出单金额: " + element.dingdje / 100
						})
						
						that.chudjlList = result.data.result
					}
				}
			
			});
		},
		methods: {
			makeCall() {
				uni.makePhoneCall({
					phoneNumber: uni.getStorageSync("memberDetail").mobile
				});
			},
			
			onClick(item) {
				uni.setStorageSync("policy", item)
			
				uni.navigateTo({
					url: '../../pages2/chudxq/chudxq'
				})
			}
			
		}
	}
</script>

<style>

</style>
